<style lang="scss">
@import '@/assets/css/variable';
.matchFail{
	background-image: linear-gradient(to bottom, #003792 , #01617a);
}
</style>

<template>
  <div class="matchFail wrapperContent2" ref="matchResult" @scroll="scrollBottom">
	<div class="mar-t-20" :style="{fontSize:fontSize==1?'18px':'21px'}">
		<div class="fc-fff padding-lr-l line-height-l letter-s-1">
			匹配失败
		</div>
		<!-- <div class="fc-fff padding-lr-l line-height-l letter-s-1">
			共{{count}}个
		</div> -->
	</div>
	<!-- <my-list :list="listCatchData[active]" :load="load[active]"></my-list> -->
  </div>
</template>
<script>
import myList from '@/components/list/IndexList.vue'
import navbar from '@/components/Navbar.vue'
import { myMixins } from "@/assets/js/mixins.js";
export default {
	mixins: [myMixins],
	name:'matchFail',
  components: {myList,navbar},
  data() {
    return {
		searchText:'',
		active:0,
		policy_keywords:'',
		is_validity:'',
		// pageSize:10,
		// currPage:1
		listCatchData:{},
		load:{},
		pageSize:100,
		count:0
    };
  },
  created() {
    // document.title = "网络学习首页";
 //  	this.bus.$on('scrollToTop4Result',()=>{
 //  		console.log("scrollToTop4Result")
 //  		// this.$refs.policy.scrollTo(0,localStorage.getItem('scrollTop'))
 //  		this.$refs.searchResult.scrollTop = localStorage.getItem('scrollTop4Result')
 //  	})
	// this.bus.$on('refreshSearchResult',()=>{
	// 	console.log('=================refreshSearchResult=========================',localStorage.getItem('searchText'))
	// 	this.policy_keywords = localStorage.getItem('searchText')||this.$route.query.searchText
	// 	this.listCatchData[0] = []
	// 	this.count = 0
	// 	this.getList(0)
	// })
  },
 //  beforeDestroy() {
 //  	console.log("off scrollToTop4Result scrollToTop4Result beforeDestroy")
 //  	this.bus.$off('scrollToTop4Result')
	// this.bus.$off('refreshSearchResult')
 //  },
  mounted() {
	  console.log('=================mounted====================')
	  
	// this.policy_keywords = this.$route.query.searchText
	// console.log("policy_keywords",this.policy_keywords)
	// this.listCatchData[0] = []
	// this.getList(0)
  },
  methods: {
	getList(current) {
		if(!this.load[current]){
			this.load[current] = {
				page:1,
				loading:'loading'
			}
		}
		const params = {
			mate_status:1,
			currPage:this.load[current].page,
			pageSize:this.pageSize
		}
		console.log('getList__params',params)
		this.$request.getMatePolicyList(params).then(res => {
			const data = res.data.list
			this.count = res.data.page.count
			//如果没数据了
			if(data.length === 0 || data.length < this.pageSize){
				let oldLoad = {}
				oldLoad.loading = 'noMore'
				oldLoad.page = this.load[current].page
				this.load[current] = oldLoad
			}
			if(data.length == this.pageSize) {
				let oldLoad = {}
				oldLoad.loading = 'loadEnd'
				oldLoad.page = this.load[current].page
				this.load[current] = oldLoad
			}
			if(data.length>0){
				let oldList = this.listCatchData[current] || []
				oldList.push(...data)
				this.listCatchData[current] = oldList
			}
		}).finally(res=>{
			if(!this.listCatchData[current]||this.listCatchData[current].length<=0){
				this.load[current].loading='noData'
			}
			// this.bus.$emit('refreshList',this.load[current])
			console.log('this.load[current]',this.load[current])
			this.$forceUpdate()
		})
	},
    searchBtn() {
		console.log("search")
	},
	scrollBottom(e) {
		// console.log('e',e)
		const {scrollTop, clientHeight, scrollHeight} = e.target
		// console.log(scrollTop, clientHeight, scrollHeight)
		localStorage.setItem('scrollTop4MatchResult',scrollTop)
		if (scrollTop + clientHeight === scrollHeight){
			console.log('滚动到底部啦')
		}
	},
  }
}

</script>